package com.dreamcar.auction.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * DestinationMarket entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "destination_market", catalog = "assignment")
public class DestinationMarket implements java.io.Serializable {

	// Fields

	private Integer idDestinationMarket;
	private String destination;
	private Set<CarModel> carModels = new HashSet<CarModel>(0);

	// Constructors

	/** default constructor */
	public DestinationMarket() {
	}

	/** minimal constructor */
	public DestinationMarket(Integer idDestinationMarket) {
		this.idDestinationMarket = idDestinationMarket;
	}

	/** full constructor */
	public DestinationMarket(Integer idDestinationMarket, String destination,
			Set<CarModel> carModels) {
		this.idDestinationMarket = idDestinationMarket;
		this.destination = destination;
		this.carModels = carModels;
	}

	// Property accessors
	@Id
	@Column(name = "ID_DESTINATION_MARKET", unique = true, nullable = false)
	public Integer getIdDestinationMarket() {
		return this.idDestinationMarket;
	}

	public void setIdDestinationMarket(Integer idDestinationMarket) {
		this.idDestinationMarket = idDestinationMarket;
	}

	@Column(name = "DESTINATION", length = 45)
	public String getDestination() {
		return this.destination;
	}

	public void setDestination(String destination) {
		this.destination = destination;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "destination_car_relation", catalog = "assignment", joinColumns = { @JoinColumn(name = "destination_market_ID_DESTINATION_MARKET", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "car_model_ID_CAR_MODEL", nullable = false, updatable = false) })
	public Set<CarModel> getCarModels() {
		return this.carModels;
	}

	public void setCarModels(Set<CarModel> carModels) {
		this.carModels = carModels;
	}

}